﻿CREATE TABLE [dbo].[mark_Note] (
    [NoteId]      BIGINT           IDENTITY (1, 1) NOT NULL,
    [TextId]      BIGINT           NOT NULL,
    [Value]       NVARCHAR (MAX)   NOT NULL,
    [Title]       NVARCHAR (256)   NOT NULL,
    [UserId]      UNIQUEIDENTIFIER NOT NULL,
    [IsUserTitle] BIT              CONSTRAINT [DF_mark_Note_IsUserTitle] DEFAULT ((0)) NOT NULL,
    [IsDeleted]   BIT              DEFAULT ((0)) NOT NULL,
    [RefNoteId]   BIGINT           NULL,
    CONSTRAINT [PK_mark_Note] PRIMARY KEY CLUSTERED ([NoteId] ASC),
    CONSTRAINT [FK_mark_Note_text_Text] FOREIGN KEY ([TextId]) REFERENCES [dbo].[text_Text] ([TextId]),
    CONSTRAINT [FK_mark_Note_user_User] FOREIGN KEY ([UserId]) REFERENCES [dbo].[user_User] ([UserId])
);






GO
CREATE NONCLUSTERED INDEX [IX_mark_Note_Ref]
    ON [dbo].[mark_Note]([RefNoteId] ASC);

